package com.jln.demo.ui.home;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import com.jln.demo.databinding.FragmentHomeBinding;

import java.util.Arrays;
import java.util.List;

public class HomeFragment extends Fragment {

    private FragmentHomeBinding binding;
    List<String> list = Arrays.asList("xxx","222","4444");
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater,
                             ViewGroup container, Bundle savedInstanceState) {
        return super.onCreateView(inflater,container,savedInstanceState);
//        binding = FragmentHomeBinding.inflate(inflater,container,false);
//        RecyclerView mRecyclerView = binding.homere;
//        mRecyclerView.setItemAnimator(new DefaultItemAnimator());
//        //        mRecyclerView.addItemDecoration();//设置分割线
//        mRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));//设置RecyclerView布局管理器为2列垂直排布
//        homeRecyclerAdapter adapter = new homeRecyclerAdapter(getContext(), list);
//        mRecyclerView.setAdapter(adapter);
//        adapter.setOnClickListener(new homeRecyclerAdapter.OnItemClickListener() {
//            @Override
//            public void ItemClickListener(View view, int postion) {
////                Toast.makeText(getContext(), "点击了：" + postion, Toast.LENGTH_SHORT).show();
//            }
//
//            @Override
//            public void ItemLongClickListener(View view, int postion) {
//                //长按删除
////                adapter.notifyItemRemoved(postion);
//            }
//        });
//        return binding.getRoot();
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        binding = null;
    }
}
